home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Scene Storm
/
Scene Storm - Volume 1.iso
/
coding
/
c
/
memleak_1.0
/
memleak.doc
< prev
next >
Wrap
Text File
|
1995-11-05
|
2KB
|
40 lines
MemLeak 1.0 -- A tool to aid discovery of memory leaks in programs.
©1994 by Francesco Devitt
email: ffranc@comp.vuw.ac.nz
smail: 29a Kinghorne St, Strathmore, Wellington, New Zealand.
Often when nearing the completion of a programming effort it becomes
necessary to test whether one's program contains any memory leaks.
The typical way this is done is to open a shell, ensuring that all
review and history buffers are off and execute "AvailMem TOTAL FLUSH"
before and after the program has run.
The FLUSH keyword is needed so that any shared libraries and other resources
that the program required are removed. It may also be necessary to call
AvailMem several times before the figure returned settles.
Now came the difficult part, actually performing the subtraction; memory
loss equals before minus after, etc.
MemLeak provides a simple way of achieving all this. All that needs to
be done is to click on the "Before" button, run the program, then
click the "After" button. The amount of memory before and after is
displayed along with a difference.
The memory size is calculated by continually attempting to allocate
all the system's memory (which will flush libraries) and the requesting the
avaiable memory. This is done until the same value is returned a number of
times. The whole process takes about one second.
MemLeak's GUI was designed with GadToolsBox, and the whole program took
half an hour to write including this documentation. Full SAS/C source code
and the gadtools source file are included.
MemLeak runs either from a shell or the workbench. There are no options
or tooltypes that need to be set.
Share and Enjoy.